package com.hqq.stack;

import com.hqq.stack.exception.StackEmptyException;
import com.hqq.stack.exception.StackFullException;

import java.util.Iterator;

/**
 * Stack
 * Created by heqianqian on 2017/8/3.
 */
public interface Stack<T> extends Iterable<T> {

    /**
     * 入栈
     */
    void push(T t) throws StackFullException;

    /**
     * 出栈
     */
    T pop() throws StackEmptyException;

    /**
     * 获得栈顶元素
     */
    T top();

    /**
     * 栈是否为空
     */
    boolean isEmpty();

    /**
     * 获取栈内元素个数
     */
    int size();

}
